//
//  LOLMineSettingPager.m
//  LOL_Little_Box
//
//  Created by dllo on 16/3/23.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "LOLMineSettingPager.h"
#import "LOLTableView.h"
#import "LOLSettingCell.h"

@interface LOLMineSettingPager ()<UITableViewDataSource , UITableViewDelegate>

@property (nonatomic , retain)NSMutableArray *contains;
@property (nonatomic , retain)LOLTableView *tableView;

@end

@implementation LOLMineSettingPager

- (NSMutableArray *)contains{
    if (_contains == nil) {
        _contains = [[NSMutableArray alloc]init];
        [_contains addObject:[NSArray arrayWithObject:[NSDictionary dictionaryWithObject:_model.region forKey:@"绑定大区"]]];
        [_contains addObject:[NSArray arrayWithObjects:@{@"消息推送设置" : @""}, @{@"隐私设置" : @""} , @{@"省流量" : @"咨询图片自动下载设置"} , @{@"清空缓存" : @""} ,nil]];
        [_contains addObject:[NSArray arrayWithObjects:@{@"关于我们" : @""}, @{@"意见反馈" : @"官方反馈qq群：现在还没有"} , nil]];
    }
    return _contains;
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"设置";
    /**创建tableView */
    [self createTableView];
    // Do any additional setup after loading the view.
}

- (void)createTableView{
    self.tableView = [[LOLTableView alloc]initWithFrame:self.view.frame];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    /**可能需要修改 */
    /**不知道为什么sectionHeaderHeight不好用 */
    self.tableView.sectionHeaderHeight = 30;
    self.tableView.rowHeight = 40;
    [self.tableView registerClass:[LOLSettingCell class] forCellReuseIdentifier:@"cell"];
    [self.view addSubview:self.tableView];
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 20;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    LOLSettingCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"];
    cell.contains = self.contains[indexPath.section][indexPath.row];
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    /**判断接下来的跳转界面 */
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return [self.contains[section] count];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return self.contains.count;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
